package test;

import java.util.ArrayList;
import java.util.List;

import org.junit.Test;

import cn.com.edu.nju.ecrec.dao.*;
import cn.com.edu.nju.ecrec.model.UserInfo;
import cn.com.edu.nju.ecrec.util.DaoName;

public class testUserInfo {
	@Test
	public void deleteById(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		uid.deleteById(1);
	}
	
	@Test
	public void getIds(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<Long> list = uid.getIds();
		for(long id : list)
			System.out.println(id);
	}
	
	@Test
	public void getCount(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		System.out.println("count:"+uid.getCount());
	}
	
	@Test
	public void getAll(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<UserInfo> list = uid.getAll();
		for(UserInfo ui: list){
			System.out.println("infoID:"+ui.getInfoID()+" userID:"+ui.getUserID()+" browser:"+ui.getBrowser()+
					" version:"+ui.getVersion()+" os:"+ui.getOs()+" platform:"+ui.getPlatform()+
					" browserLanguage:"+ui.getBrowserLanguage()+" systemLanguage:"+ui.getSystemLanguage()+
					" userLanguage:"+ui.getUserLanguage()+" country:"+ui.getCountry()+" region:"+ui.getRegion()+
					" city:"+ui.getCity()+" refer_url:"+ui.getRefer_url());
		}
	}
	
	@Test
	public void getByUserID(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<String> userIDs = new ArrayList<String>();
		userIDs.add("12955831467760.1442439072153019");
		userIDs.add("12955832717560.5130130755253064");
		List<UserInfo> list = uid.getByUserIDs(userIDs);
		for(UserInfo ui: list){
			System.out.println("infoID:"+ui.getInfoID()+" userID:"+ui.getUserID()+" browser:"+ui.getBrowser()+
					" version:"+ui.getVersion()+" os:"+ui.getOs()+" platform:"+ui.getPlatform()+
					" browserLanguage:"+ui.getBrowserLanguage()+" systemLanguage:"+ui.getSystemLanguage()+
					" userLanguage:"+ui.getUserLanguage()+" country:"+ui.getCountry()+" region:"+ui.getRegion()+
					" city:"+ui.getCity()+" refer_url:"+ui.getRefer_url());
		}
	}
	
	@Test
	public void getByUriName(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<UserInfo> list = uid.getByUriName("coach-green-soho-pleated-tote-leather-bag-13732");
		for(UserInfo ui: list){
			System.out.println("infoID:"+ui.getInfoID()+" userID:"+ui.getUserID()+" browser:"+ui.getBrowser()+
					" version:"+ui.getVersion()+" os:"+ui.getOs()+" platform:"+ui.getPlatform()+
					" browserLanguage:"+ui.getBrowserLanguage()+" systemLanguage:"+ui.getSystemLanguage()+
					" userLanguage:"+ui.getUserLanguage()+" country:"+ui.getCountry()+" region:"+ui.getRegion()+
					" city:"+ui.getCity()+" refer_url:"+ui.getRefer_url());
		}
	}
	
	@Test
	public void getByBrowser(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<UserInfo> list = uid.getByBrowser("FIREFOX");
		for(UserInfo ui: list){
			System.out.println("infoID:"+ui.getInfoID()+" userID:"+ui.getUserID()+" browser:"+ui.getBrowser()+
					" version:"+ui.getVersion()+" os:"+ui.getOs()+" platform:"+ui.getPlatform()+
					" browserLanguage:"+ui.getBrowserLanguage()+" systemLanguage:"+ui.getSystemLanguage()+
					" userLanguage:"+ui.getUserLanguage()+" country:"+ui.getCountry()+" region:"+ui.getRegion()+
					" city:"+ui.getCity()+" refer_url:"+ui.getRefer_url());
		}
	}
	
	@Test
	public void getByBrowserVersion(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<UserInfo> list = uid.getByBrowserVersion("MSIE", "9.0");
		for(UserInfo ui: list){
			System.out.println("infoID:"+ui.getInfoID()+" userID:"+ui.getUserID()+" browser:"+ui.getBrowser()+
					" version:"+ui.getVersion()+" os:"+ui.getOs()+" platform:"+ui.getPlatform()+
					" browserLanguage:"+ui.getBrowserLanguage()+" systemLanguage:"+ui.getSystemLanguage()+
					" userLanguage:"+ui.getUserLanguage()+" country:"+ui.getCountry()+" region:"+ui.getRegion()+
					" city:"+ui.getCity()+" refer_url:"+ui.getRefer_url());
		}
	}
	
	@Test
	public void getByBrowserLan(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<UserInfo> list = uid.getByBrowserLan("MSIE", "en");
		for(UserInfo ui: list){
			System.out.println("infoID:"+ui.getInfoID()+" userID:"+ui.getUserID()+" browser:"+ui.getBrowser()+
					" version:"+ui.getVersion()+" os:"+ui.getOs()+" platform:"+ui.getPlatform()+
					" browserLanguage:"+ui.getBrowserLanguage()+" systemLanguage:"+ui.getSystemLanguage()+
					" userLanguage:"+ui.getUserLanguage()+" country:"+ui.getCountry()+" region:"+ui.getRegion()+
					" city:"+ui.getCity()+" refer_url:"+ui.getRefer_url());
		}
	}
	
	@Test
	public void getByOsInfo(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<UserInfo> list = uid.getByOsInfo("WINDOWS NT 5.1");
		for(UserInfo ui: list){
			System.out.println("infoID:"+ui.getInfoID()+" userID:"+ui.getUserID()+" browser:"+ui.getBrowser()+
					" version:"+ui.getVersion()+" os:"+ui.getOs()+" platform:"+ui.getPlatform()+
					" browserLanguage:"+ui.getBrowserLanguage()+" systemLanguage:"+ui.getSystemLanguage()+
					" userLanguage:"+ui.getUserLanguage()+" country:"+ui.getCountry()+" region:"+ui.getRegion()+
					" city:"+ui.getCity()+" refer_url:"+ui.getRefer_url());
		}
	}
	
	@Test
	public void getByUserLan(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<UserInfo> list = uid.getByUserLan("WINDOWS NT 5.1", "uk");
		for(UserInfo ui: list){
			System.out.println("infoID:"+ui.getInfoID()+" userID:"+ui.getUserID()+" browser:"+ui.getBrowser()+
					" version:"+ui.getVersion()+" os:"+ui.getOs()+" platform:"+ui.getPlatform()+
					" browserLanguage:"+ui.getBrowserLanguage()+" systemLanguage:"+ui.getSystemLanguage()+
					" userLanguage:"+ui.getUserLanguage()+" country:"+ui.getCountry()+" region:"+ui.getRegion()+
					" city:"+ui.getCity()+" refer_url:"+ui.getRefer_url());
		}
	}
	
	@Test
	public void getByPlatform(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<UserInfo> list = uid.getByPlatform("iPod");
		for(UserInfo ui: list){
			System.out.println("infoID:"+ui.getInfoID()+" userID:"+ui.getUserID()+" browser:"+ui.getBrowser()+
					" version:"+ui.getVersion()+" os:"+ui.getOs()+" platform:"+ui.getPlatform()+
					" browserLanguage:"+ui.getBrowserLanguage()+" systemLanguage:"+ui.getSystemLanguage()+
					" userLanguage:"+ui.getUserLanguage()+" country:"+ui.getCountry()+" region:"+ui.getRegion()+
					" city:"+ui.getCity()+" refer_url:"+ui.getRefer_url());
		}
	}
	
	@Test
	public void getBySysLan(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<UserInfo> list = uid.getBySysLan("iPod", "nl-nl");
		for(UserInfo ui: list){
			System.out.println("infoID:"+ui.getInfoID()+" userID:"+ui.getUserID()+" browser:"+ui.getBrowser()+
					" version:"+ui.getVersion()+" os:"+ui.getOs()+" platform:"+ui.getPlatform()+
					" browserLanguage:"+ui.getBrowserLanguage()+" systemLanguage:"+ui.getSystemLanguage()+
					" userLanguage:"+ui.getUserLanguage()+" country:"+ui.getCountry()+" region:"+ui.getRegion()+
					" city:"+ui.getCity()+" refer_url:"+ui.getRefer_url());
		}
	}
	
	@Test
	public void getByCountry(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<UserInfo> list = uid.getByCountry("Colombia");
		for(UserInfo ui: list){
			System.out.println("infoID:"+ui.getInfoID()+" userID:"+ui.getUserID()+" browser:"+ui.getBrowser()+
					" version:"+ui.getVersion()+" os:"+ui.getOs()+" platform:"+ui.getPlatform()+
					" browserLanguage:"+ui.getBrowserLanguage()+" systemLanguage:"+ui.getSystemLanguage()+
					" userLanguage:"+ui.getUserLanguage()+" country:"+ui.getCountry()+" region:"+ui.getRegion()+
					" city:"+ui.getCity()+" refer_url:"+ui.getRefer_url());
		}
	}
	
	@Test
	public void getByRegion(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<UserInfo> list = uid.getByRegion("Colombia", "Atlantico");
		for(UserInfo ui: list){
			System.out.println("infoID:"+ui.getInfoID()+" userID:"+ui.getUserID()+" browser:"+ui.getBrowser()+
					" version:"+ui.getVersion()+" os:"+ui.getOs()+" platform:"+ui.getPlatform()+
					" browserLanguage:"+ui.getBrowserLanguage()+" systemLanguage:"+ui.getSystemLanguage()+
					" userLanguage:"+ui.getUserLanguage()+" country:"+ui.getCountry()+" region:"+ui.getRegion()+
					" city:"+ui.getCity()+" refer_url:"+ui.getRefer_url());
		}
	}
	
	@Test
	public void getByCity(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<UserInfo> list = uid.getByCity("Colombia", "Atlantico", "Barranquilla");
		for(UserInfo ui: list){
			System.out.println("infoID:"+ui.getInfoID()+" userID:"+ui.getUserID()+" browser:"+ui.getBrowser()+
					" version:"+ui.getVersion()+" os:"+ui.getOs()+" platform:"+ui.getPlatform()+
					" browserLanguage:"+ui.getBrowserLanguage()+" systemLanguage:"+ui.getSystemLanguage()+
					" userLanguage:"+ui.getUserLanguage()+" country:"+ui.getCountry()+" region:"+ui.getRegion()+
					" city:"+ui.getCity()+" refer_url:"+ui.getRefer_url());
		}
	}
	
	@Test
	public void getBrowsers(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<String> list = uid.getBrowsers();
		for(String ui: list){
			System.out.println(ui);
		}
	}
	
	@Test
	public void getVersionsByBrowser(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<String> list = uid.getVersionsByBrowser("MSIE");
		for(String ui: list){
			System.out.println(ui);
		}
	}
	
	@Test
	public void getLansByBrowser(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<String> list = uid.getLansByBrowser("MSIE");
		for(String ui: list){
			System.out.println(ui);
		}
	}
	
	@Test
	public void getOs(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<String> list = uid.getOs();
		for(String ui: list){
			System.out.println(ui);
		}
	}
	
	@Test
	public void getLansByOs(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<String> list = uid.getLansByOs("WINDOWS NT 5.1");
		for(String ui: list){
			System.out.println(ui);
		}
	}
	
	@Test
	public void getPlatforms(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<String> list = uid.getPlatforms();
		for(String ui: list){
			System.out.println(ui);
		}
	}
	
	@Test
	public void getUserLans(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<String> list = uid.getUserLans();
		for(String ui: list){
			System.out.println(ui);
		}
	}
	
	@Test
	public void getLansByPlatform(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<String> list = uid.getLansByPlatform("iPod");
		for(String ui: list){
			System.out.println(ui);
		}
	}
	
	@Test
	public void getCountrys(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<String> list = uid.getCountrys();
		for(String ui: list){
			System.out.println(ui);
		}
	}
	
	@Test
	public void getRegionsByCountry(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<String> list = uid.getRegionsByCountry("Colombia");
		for(String ui: list){
			System.out.println(ui);
		}
	}
	
	@Test
	public void getCitysByRegion(){
		UserInfoDao uid = DaoFactory.getInstance().getDao(DaoName.USER_INFO_DAO);
		List<String> list = uid.getCitysByRegion("Atlantico");
		for(String ui: list){
			System.out.println(ui);
		}
	}
}